package practice.practice6;

interface DogState{
    public void showState();
}

class SoftlyState implements DogState{
    @Override
    public void showState() {
        System.out.println("nice");
    }
}

class MeetEnemyState implements DogState{
    @Override
    public void showState() {
        System.out.println("loudly");
    }
}

class Dog{
    private DogState state;
    public void show(){
        state.showState();
    }

    public void setState(DogState state){
        this.state=state;
    }
}


public class CheckDogState {


    public static void main(String[] args) {



        Dog greenDog=new Dog();
        SoftlyState soft=new SoftlyState();
        greenDog.setState(soft);
        greenDog.show();
        greenDog.setState(new MeetEnemyState());
        greenDog.show();


    }

}
